package com.cn.demo.disruptor;

import com.lmax.disruptor.EventTranslator;

/**
 * 描述
 *
 * @author wangjf
 * @version 1.0
 * @createDate 2019/11/25 15:30
 * @projectName demo
 */
public class MyInParkingDataEventTranslator implements EventTranslator<MyInParkingDataEvent> {
    @Override
    public void translateTo(MyInParkingDataEvent myInParkingDataEvent, long l) {
        this.generateData(myInParkingDataEvent);
    }
    private MyInParkingDataEvent generateData(MyInParkingDataEvent myInParkingDataEvent) {
        // 随机生成一个车牌号
        myInParkingDataEvent.setCarLicense("车牌号： 赣A-" + (int)(Math.random() * 100000));
        System.out.println("Thread Id " + Thread.currentThread().getId() + " 写完一个event");
        return myInParkingDataEvent;
    }
}
